Closed Bug 1424368 Opened 7 years ago Closed 7 years ago

comparison of constant -1 with expression of type 'const (anonymous namespace)::WasmToken::Kind' is always true [-Werror,-Wtautological-constant-out-of-range-compare]

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: Sylvestre, Assigned: bbouvier)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

With clang trunk: In file included from /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/js/src/Unified_cpp_js_src42.cpp:47: /data/jenkins/workspace/firefox-clang-last/js/src/wasm/WasmTextToBinary.cpp:234:26: error: comparison of constant -1 with expression of type 'const (anonymous namespace)::WasmToken::Kind' is always true [-Werror,-Wtautological-constant-out-of-range-compare] MOZ_ASSERT(kind_ != Kind(-1)); ~~~~~ ^ ~~~~~~~~ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:457:46: note: expanded from macro 'MOZ_ASSERT' # define MOZ_ASSERT(...) MOZ_RELEASE_ASSERT(__VA_ARGS__) ^~~~~~~~~~~ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:454:6: note: expanded from macro 'MOZ_RELEASE_ASSERT' (__VA_ARGS__)) ^~~~~~~~~~~ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:450:41: note: expanded from macro 'MOZ_RELEASE_ASSERT_GLUE' #define MOZ_RELEASE_ASSERT_GLUE(a, b) a b ^ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Assertions.h:433:51: note: expanded from macro 'MOZ_ASSERT_HELPER1' if (MOZ_UNLIKELY(!MOZ_CHECK_ASSERT_ASSIGNMENT(expr))) { \ ^~~~ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/StaticAnalysisFunctions.h:56:47: note: expanded from macro 'MOZ_CHECK_ASSERT_ASSIGNMENT' #define MOZ_CHECK_ASSERT_ASSIGNMENT(expr) (!!(expr)) ^~~~ /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/mozilla/Likely.h:17:48: note: expanded from macro 'MOZ_UNLIKELY' # define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
Could you take care of that? :)
Flags: needinfo?(bbouvier)
The attached patch removes the -1 enum value hack and uses a real Invalid enum value instead, which should be enough for static analysis.
Flags: needinfo?(bbouvier)
Assignee: nobody → bbouvier
Status: NEW → ASSIGNED
To be clear, this is a warning with gcc 8
Comment on attachment 8936646 [details] Bug 1424368: Use an enum value for invalid WasmToken::Kind; https://reviewboard.mozilla.org/r/207388/#review213312 Thanks!
Attachment #8936646 - Flags: review?(luke) → review+
Pushed by bbouvier@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a5c733e0b6d1 Use an enum value for invalid WasmToken::Kind; r=luke
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
No longer blocks: clang-based-analysis
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: